<template>
    <div>
        <form @submit.prevent="doLogin">
            <input type="text" name="" id="" v-model="username">
            <input type="text" name="" id="">
            <button>登录</button>
        </form>
    </div>
</template>

<script>
export default {
    data(){
        return{
            username:""
        }
    },
    methods:{
        doLogin(){
            console.log(this.username);
            localStorage.setItem("usr",this.username);
            this.$router.push("/")
        }
    }
}
</script>